package cn.school.thoughtworks.section1;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class PracticeC {
    List<String> collectSameElements(List<String> collection1, Map<String,List<String>> collection2) {
        Stream<String> stream = collection1.stream();
        Stream<String> stringStream = stream.filter(collection2.get("value")::contains);
        return stringStream.collect(Collectors.toList());

        //实现练习要求，并改写该行代码。
        /*List<String> list=new ArrayList();
        List<String> List2 = collection2.get("value");
        for(int i=0;i<(collection1.size());i++){
            for(int j=0;j<(List2.size());j++){
                   if(collection1.get(i)==List2.get(j)){
                       list.add(collection1.get(i));
                   }
            }
        }
        return list;*/
    }
}
